﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LongestDesc.Question;
namespace LongestDesc.Answer
{
    class Bob : ILongestDesc
    {
        public int GetLongestDesc(int[] iarr)
        {
            int[] res = new int[iarr.Length];

            for (int i = 0; i < iarr.Length; i++)
            {
                res[i] = 1;
            }


            for (int i = 0; i < iarr.Length; i++)
            {
                for (int j = i - 1; j >= 0; j--)
                {
                    if (iarr[j] >= iarr[i])
                    {
                        res[i] = Math.Max(res[i], res[j] + 1);
                    }
                }
            }

            int max = 0;

            foreach (var i in res)
            {
                max = Math.Max(i, max);
            }
            return max;


        }

    }
}
